package com.zyh.abstract1;

public class AbstractDemo1 {
    public static void main(String[] args) {
        Zi zi = new Zi();
        System.out.println(zi.age);
        zi.eat();
        zi.sleep();
    }
}
abstract class Fu{
    public int age;

    //构造方法
    public Fu() {
    }
    public Fu(int age) {
        this.age = age;
    }

    //行为
    public  void eat(){
        System.out.println("这是抽象类中的eat");
    }

    //抽象方法
    public abstract void sleep();
}

class Zi extends Fu{
    public Zi() {
        //super();
    }
    public Zi(int age) {
        super(age);
    }

    @Override
    public void sleep() {
        System.out.println("重写Fu中的抽象方法");
    }
}